/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author owtee
 */
@Entity
@Table(name = "contact")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contact.findAll", query = "SELECT c FROM Contact c"),
    @NamedQuery(name = "Contact.findByConId", query = "SELECT c FROM Contact c WHERE c.conId = :conId"),
    @NamedQuery(name = "Contact.findByConName", query = "SELECT c FROM Contact c WHERE c.conName = :conName"),
    @NamedQuery(name = "Contact.findByConTel", query = "SELECT c FROM Contact c WHERE c.conTel = :conTel"),
    @NamedQuery(name = "Contact.findByActiveFlag", query = "SELECT c FROM Contact c WHERE c.activeFlag = :activeFlag"),
    @NamedQuery(name = "Contact.findByCreateUser", query = "SELECT c FROM Contact c WHERE c.createUser = :createUser"),
    @NamedQuery(name = "Contact.findByCreateDate", query = "SELECT c FROM Contact c WHERE c.createDate = :createDate"),
    @NamedQuery(name = "Contact.findByModifyUser", query = "SELECT c FROM Contact c WHERE c.modifyUser = :modifyUser"),
    @NamedQuery(name = "Contact.findByModifyDate", query = "SELECT c FROM Contact c WHERE c.modifyDate = :modifyDate")})
public class Contact implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Con_Id")
    private Integer conId;
    @Size(max = 50)
    @Column(name = "Con_Name")
    private String conName;
    @Size(max = 20)
    @Column(name = "Con_Tel")
    private String conTel;
    @Column(name = "Active_Flag")
    private Boolean activeFlag;
    @Size(max = 10)
    @Column(name = "Create_User")
    private String createUser;
    @Column(name = "Create_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Size(max = 10)
    @Column(name = "Modify_User")
    private String modifyUser;
    @Column(name = "Modify_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifyDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "conId")
    private Collection<Jobs> jobsCollection;
    @JoinColumn(name = "Con_Com_Id", referencedColumnName = "Con_Com_Id")
    @ManyToOne(optional = false)
    private ContactCompany conComId;

    public Contact() {
    }

    public Contact(Integer conId) {
        this.conId = conId;
    }

    public Integer getConId() {
        return conId;
    }

    public void setConId(Integer conId) {
        this.conId = conId;
    }

    public String getConName() {
        return conName;
    }

    public void setConName(String conName) {
        this.conName = conName;
    }

    public String getConTel() {
        return conTel;
    }

    public void setConTel(String conTel) {
        this.conTel = conTel;
    }

    public Boolean getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(Boolean activeFlag) {
        this.activeFlag = activeFlag;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getModifyUser() {
        return modifyUser;
    }

    public void setModifyUser(String modifyUser) {
        this.modifyUser = modifyUser;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    @XmlTransient
    public Collection<Jobs> getJobsCollection() {
        return jobsCollection;
    }

    public void setJobsCollection(Collection<Jobs> jobsCollection) {
        this.jobsCollection = jobsCollection;
    }

    public ContactCompany getConComId() {
        return conComId;
    }

    public void setConComId(ContactCompany conComId) {
        this.conComId = conComId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (conId != null ? conId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contact)) {
            return false;
        }
        Contact other = (Contact) object;
        if ((this.conId == null && other.conId != null) || (this.conId != null && !this.conId.equals(other.conId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Contact[ conId=" + conId + " ]";
    }
    
}
